home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 027a / onotes.zip / GETS.TXT < prev    next >
Text File  |  1991-04-19  |  9KB  |  179 lines

  1. *╔═══════════════════════════════════════════════════════════════════════════╗*
  2. *║   Description:   There are different ways to create a GET.  Here are just ║*
  3. *║                  three that will create the same GET.                     ║*
  4. *║   Author.....:   Micheal Todd Charron                                     ║*
  5. *║   Notes......:   Hope it Helps.                                           ║*
  6. *║                                                                           ║*
  7. *║   Copyright..:   (c) The people at Nantucket Canada, 1991                 ║*
  8. *╚═══════════════════════════════════════════════════════════════════════════╝*
  9.  
  10. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  11. * FIRST EXAMPLE ***************************************************************
  12.  
  13. FUNCTION Main()
  14.         LOCAL cVar := SPACE( 30 )
  15.  
  16.         @12, 30 GET cVar PICTURE '@!' VALID ( ! EMPTY( cVar ) )
  17.  
  18.         READ
  19.  
  20. RETURN Nil
  21.  
  22. *******************************************************************************
  23.    ╒═══════════════════════════════════════════════════════════════════════╕
  24.    │  @12, 30 GET cVar PICTURE '@!' VALID ( ! EMPTY( cVar ) )              │
  25.    ╘═══════════════════════════════════════════════════════════════════════╛
  26. Nothing special about the above GET.  The above GET could be compiled in SUMMER
  27. '87 with no modification.  In fact, with the VALID clause stripped off, it
  28. could be used in any dBase dialect.
  29.  
  30. At row 12, column 30 (@12, 30) the variable cVar will be edited with all the
  31. letters changed to upper case.  The VALID clause will not let the user finish
  32. the GET if the editing buffer is empty.
  33. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  34.  
  35. -------------------------------------------------------------------------------
  36.  
  37. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  38. * SECOND EXAMPLE **************************************************************
  39.  
  40. FUNCTION Main()
  41.         LOCAL cVar := SPACE( 30 )
  42.         LOCAL oGet
  43.  
  44.         oGet := GETNEW( 12, 30, { | x | IF( x == Nil, cVar, cVar := x ) },;
  45.                 'cVar', '@!' )
  46.  
  47.         oGet:POSTBLOCK := { || ! EMPTY( cVar ) }
  48.  
  49.         READMODAL( { oGet } )
  50.  
  51. RETURN Nil
  52.  
  53. *******************************************************************************
  54. This is the object oriented way of creating a GET.  The variable "oGet" will
  55. contain the reference to the object created by the function GETNEW().
  56.  
  57.    ╒═══════════════════════════════════════════════════════════════════════╕
  58.    │  oGet := GETNEW( 12, 30, { | x | IF( x == Nil, cVar, cVar := x ) },;  │
  59.    │           'cVar', '@!' )                                              │
  60.    ╘═══════════════════════════════════════════════════════════════════════╛
  61. GETNEW() will create an object that will contain the characteristics of this
  62. particular GET.  The first and second parameters of the GETNEW() function are
  63. (respectively) the row and column of this GET.  The third parameter is the code
  64. block which will handle the display of the value in the GET.  The fourth
  65. parameter is the name of the variable and the fifth parameter is the picture
  66. string which controls the display and editing of the GET.
  67.  
  68. All of these parameters are stored inside of the GET object and will be used
  69. in the READMODAL() function.
  70.  
  71.    ╒═══════════════════════════════════════════════════════════════════════╕
  72.    │  oGet:POSTBLOCK := { || ! EMPTY( cVar ) }                             │
  73.    ╘═══════════════════════════════════════════════════════════════════════╛
  74. This line essentially creates the VALID clause for the GET object.  After the
  75. GET is exited this block will be evaluated (hence the POST in POSTBLOCK).
  76.  
  77.    ╒═══════════════════════════════════════════════════════════════════════╕
  78.    │  READMODAL( { oGet } )                                                │
  79.    ╘═══════════════════════════════════════════════════════════════════════╛
  80. This line passes the GET object into the READMODAL() function.  The READMODAL()
  81. function contains all the routines for editing this GET.  If you are feeling
  82. adventurous look at the READMODAL() function in GETSYS.PRG which should be
  83. located in the /SOURCE/SYS subdirectory in you CLIPPER directory.
  84.  
  85. The reason the curly braces enclose the GET object is that the READMODAL()
  86. function uses arrays to move through the different GET objects.  With the curly
  87. braces we create a literal array with that one GET object contained in it.
  88.  
  89. The first GET example actually does something similar in that it creates the
  90. GET object and then stores it in an array called 'GETLIST'.  When you issue the
  91. READ command it calls the READMODAL() function and passes the 'GETLIST' array
  92. into the READMODAL() function.
  93. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  94.  
  95. -------------------------------------------------------------------------------
  96.  
  97. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  98. * THIRD EXAMPLE ***************************************************************
  99.  
  100. FUNCTION Main()
  101.         LOCAL cVar := SPACE( 30 )
  102.         LOCAL oGet
  103.  
  104.         oGet := GETNEW()
  105.  
  106.         oGet:ROW := 12
  107.         oGet:COL := 30
  108.         oGet:BLOCK := { | x | IF( x == Nil, cVar, cVar := x ) }
  109.         oGet:NAME := 'cVar'
  110.         oGet:PICTURE := '@!'
  111.  
  112.         oGet:POSTBLOCK := { || ! EMPTY( cVar ) }
  113.  
  114.         READMODAL( { oGet } )
  115.  
  116. RETURN Nil
  117.  
  118. *******************************************************************************
  119.    ╒═══════════════════════════════════════════════════════════════════════╕
  120.    │  oGet := GETNEW()                                                     │
  121.    ╘═══════════════════════════════════════════════════════════════════════╛
  122. The GETNEW() function without any parameters will create a GET object with very
  123. little stored inside of it.  The characteristics of the GET must be added after
  124. this line.
  125.  
  126.    ╒═══════════════════════════════════════════════════════════════════════╕
  127.    │  oGet:ROW := 12                                                       │
  128.    │  oGet:COL := 30                                                       │
  129.    ╘═══════════════════════════════════════════════════════════════════════╛
  130. Stores the row and column locations inside of the GET object.
  131.  
  132.    ╒═══════════════════════════════════════════════════════════════════════╕
  133.    │  oGet:BLOCK := { | x | IF( x == Nil, cVar, cVar := x ) }              │
  134.    ╘═══════════════════════════════════════════════════════════════════════╛
  135. Stores the code block which is responsible for retrieving a value for the GET
  136. that is on the screen and assigning the new edited value to the GET's variable.
  137.  
  138. When the GET receives input focus (the mode which makes the GET ready for
  139. editing methods) it will evaluate this code block and display the current value
  140. of the GET's variable.  When displaying the GET, no parameters will be passed
  141. to the code block therefore the variable 'x' will have a value of NIL.
  142.  
  143.    ╒═══════════════════════════════════════════════════════════════════════╕
  144.    │  oGet:NAME := 'cVar'                                                  │
  145.    ╘═══════════════════════════════════════════════════════════════════════╛
  146. This line stores the name of the GET's variable into the object.  This is
  147. optional and really is only needed in order for the READVAR() function to work
  148. while using the READMODAL() function.  It is a nice way to document a GET
  149. object and can assist you in finding a GET object logically rather that
  150. physically.
  151.  
  152.    ╒═══════════════════════════════════════════════════════════════════════╕
  153.    │  oGet:PICTURE := '@!'                                                 │
  154.    ╘═══════════════════════════════════════════════════════════════════════╛
  155. This line stores the picture string for formating and editing of the GET.
  156.  
  157. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  158.  
  159. -------------------------------------------------------------------------------
  160.  
  161. Either of these three methods will give the same result.  The fact is that you
  162. should use the method that makes you most comfortable but I will tell you that
  163. by using the second or third examples you will find that you have more
  164. flexibility in what you can do with GETs in CLIPPER 5.0/5.01.  Try out the
  165. GET class, you'll see that it really isn't as difficult as it looks.
  166.  
  167. -------------------------------------------------------------------------------
  168.  
  169. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  170.  
  171. The only difference between the first example and the second and third examples
  172. is that the old way of creating a get will automatically display the GET on the
  173. screen whereas the second and third examples will not display until you use the
  174. READMODAL() function.  This is because of compatibility for those who displayed
  175. variables in the GET color without actually editing those GETs.  In the second
  176. and third examples you can do this by issuing the DISPLAY() method rather than
  177. using the READMODAL() function.
  178.  
  179.